import time

from selenium import webdriver


#打开浏览器
driver =webdriver.Chrome()
#输入网址
driver.get('http://www.baidu.com/')
#添加登录相关的cookie
cookies =[
    {'name':'BDUSS',
     'value':'XXX'},
    {
     'name':'BDUSS_BFESS',
     'value':'xxxx'
    }
]
for cookie in cookies:
    driver.add_cookie(cookie)  #遍历添加cookie

driver.refresh()
time.sleep(2)
driver.quit()